package ooday02;
/* 方法重写的演示 */
public class OverrideDemo {
    public static void main(String[] args) {
        //重写方法被调用时，看对象的类型执行方法（new谁就调谁）
        Student zg = new Student("张光",24,"廊坊","jsd2406","003");
        //调用Student中的成员方法
        zg.sayHi();
        Teacher ll = new Teacher("李林",24,"北京",5000);
        //调用Teacher中的成员方法
        ll.sayHi();
        Doctor zl = new Doctor("赵亮",45,"北京","主任");
        //调用Person中的成员方法
        zl.sayHi();
    }
}
